<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
    </head>
    <script src="https://code.jquery.com/jquery-3.3.1.min.js" crossorigin="anonymous"></script>
    <body>
        <input type="button" value="发送" onclick="send()">
        <script>
            function send() {
                $.ajax({
                    url: '/community/ajax',
                    type: 'post',
                    data: {
                        "name": "zhangsan",
                        "age": 18
                    },
                    dataType: 'json',
                    success: function (data) {
                        console.log(data);
                        alert(data);
                        console.log(typeof (data));
                    },
                    error: function (errorMsg) {
                        alert(errorMsg.msg);
                    }
                });
            }
        </script>
    </body>
</html>